@echo off
if "%1" == "h" goto begin
mshta vbscript:createobject("wscript.shell").run("""%~nx0"" h",0)(window.close)&&exit
:begin

@REM :run
@REM set strPath=%~dp0
@REM ::set logName = "monitor"
@REM set strFile=%strPath%\\monitor.log
@REM echo [%time%] >>%strFile%
@REM tasklist /v -fi "IMAGENAME eq AutoScrShot.exe" -fi "SessionName ne Services">>%strFile%
@REM set exe=AutoScrShot.exe

@REM set /a num = 0
@REM for /f %%i in ('tasklist -fi "SessionName ne Services" ^|find /c /i "%exe%"') do (
@REM     echo %exe% number: %%i
@REM     if %%i gtr %num% (
@REM         echo %exe% exist
@REM     ) else (
@REM         echo restart %exe%
@REM         ::start "agent" cmd /k run.bat"
@REM         ::start ""/min "D:\\Monitor\\AutoScrShot.exe" 
@REM         start ""/min "%strPath%\\AutoScrShot.exe"
@REM     )
@REM )

@REM tasklist /v -fi "IMAGENAME eq baidunetdisk.exe" -fi "SessionName ne Services">>%strFile%
@REM set exe1=baidunetdisk.exe
@REM set /a num = 0
@REM for /f %%i in ('tasklist -fi "SessionName ne Services" ^|find /c /i "%exe1%"') do (
@REM     echo %exe1% number: %%i
@REM     if %%i gtr %num% (
@REM         echo %exe1% exist
@REM     ) else (
@REM         echo restart %exe1%
@REM         ::start "agent" cmd /k run.bat"
@REM         ::start ""/min "D:\\Monitor\\AutoScrShot.exe" 
@REM         start ""/min "C:\Users\27975\AppData\Roaming\baidu\BaiduNetdisk\BaiduNetdisk.exe"
@REM     )
@REM )
::choice /t 60 /d y /n >nul
python monPC.py
::start monPC.exe
@REM timeout /t 30 /nobreak
@REM goto run